<template>
    <div>
        <div class="title-header">
            <div class="line"></div>
            <h3>成品入库复核</h3>
        </div>
        <base-list ref="person" :condition="condition" :datas.sync="person" :pageSearch="pageSearch">
            <el-form :inline="true" :model="condition" class="search-form" slot="search" label-width="80px">
                <el-row>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="货主单位">
                            <auto-search-name v-model="condition['search_EQ_cargoOwnerId']" placeholder="请选择"
                                @selectId="v=>condition['search_EQ_cargoOwnerId']=v">
                            </auto-search-name>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="加工单号">
                            <el-input v-model="condition['search_LIKE_planNo']"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="发货单号">
                            <el-input v-model="condition['search_LIKE_eDeliveryNo']"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="品名">
                            <el-select v-model="condition['search_EQ_cargoCode']" placeholder="请选择" clearable
                                filterable>
                                <el-option v-for="item in cargoNameList" :key="item.cargoCode" :label="item.cargoName"
                                    :value="item.cargoCode"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="search-width8">
                        <el-form-item label="规格">
                            <el-col :span="8">
                                <el-form-item class="gg-input">
                                    <auto-search-dic @selectName="v=>condition['search_EQ_normOne']=v" code="CARGO_GGY">
                                    </auto-search-dic>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item class="gg-input">
                                    <auto-search-dic @selectName="v=>condition['search_EQ_normTwo']=v" code="CARGO_GGE">
                                    </auto-search-dic>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item class="gg-input">
                                    <auto-search-dic @selectName="v=>condition['search_EQ_normThree']=v"
                                        code="CARGO_GGS"></auto-search-dic>
                                </el-form-item>
                            </el-col>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="材质">
                            <auto-search-dic @selectName="v=>condition['search_EQ_material']=v" code="CARGO_CZ">
                            </auto-search-dic>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="生产厂家" clearable>
                            <auto-search-dic v-model="condition['search_EQ_madeBy']"
                                @selectName="v=>condition['search_EQ_madeBy']=v" code="CARGO_SCZ"></auto-search-dic>
                        </el-form-item>
                    </el-col>
                    <el-col :span="13" class="search-width4">
                        <el-form-item label="创建时间" class="label-width">
                            <el-date-picker style="width:150px;" v-model="condition['search_GTE_createDateTime']"
                                type="date" placeholder="选择日期" value-format="yyyy-MM-dd 00:00:00"> </el-date-picker> 至
                            <el-date-picker style="width:150px;" v-model="condition['search_LTE_createDateTime']"
                                type="date" placeholder="选择日期" value-format="yyyy-MM-dd 23:59:59"> </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="3" class="search-width4">
                        <el-button type="primary" icon="el-icon-search" @click="loadData" class="ml-80">查 询</el-button>
                    </el-col>
                </el-row>
            </el-form>
            <el-table slot="list" :data="person" border stripe max-height="500">
                <el-table-column label="序号" type="index" width="50"></el-table-column>
                <el-table-column label="加工单" prop="planNo"></el-table-column>
                <el-table-column label="发货单号" prop="edeliveryNo"></el-table-column>
                <el-table-column label="状态" prop="auditStatus">
                    <template slot-scope='scope'>
                        {{scope.row.auditStatus | _filterBillAuditStatus}}
                    </template>
                </el-table-column>
                <el-table-column label="来料方式" prop="cargoFrom">
                    <template slot-scope='scope'>
                        {{scope.row.cargoFrom | _filterCargoFromStatus}}
                    </template>
                </el-table-column>
                <el-table-column label="货主" prop="cargoOwnerName"></el-table-column>
                <el-table-column label="品名" prop="cargoName"></el-table-column>
                <el-table-column label="规格" prop="cargoName">
                    <template slot-scope="scope">
                        {{scope.row.normOne + '*'+ scope.row.normTwo + '*' + scope.row.normThree}}
                    </template>
                </el-table-column>
                <el-table-column label="材质" prop="material"></el-table-column>
                <el-table-column label="生产厂家" prop="madeBy"></el-table-column>
                <el-table-column label="加工方式" prop="machiningMode">
                    <template slot-scope='scope'>
                        {{scope.row.machiningMode | _filterMachiningModeStatus}}
                    </template>
                </el-table-column>
                <el-table-column label="加工类型" prop="ifAll">
                    <template slot-scope='scope'>
                        {{scope.row.ifAll?'是':'否'}}
                    </template>
                </el-table-column>
                <el-table-column label="加工重量" prop="machiningWeight"></el-table-column>
                <el-table-column label="加工数量" prop="machiningNum"></el-table-column>
                <el-table-column label="创建人" prop="createBy"></el-table-column>
                <el-table-column label="创建时间" prop="createDateTime"></el-table-column>
                <el-table-column align="center" label="操作" width="150">
                    <template slot-scope="scope">
                        <el-button size="small" type="text" @click="handleDialogFormOpen(scope.row)">
                            查看
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </base-list>
        <processFormDea ref="processFormDea" @load="loadData"></processFormDea>
    </div>
</template>
<script>
    import autoSearchName from '@/components/autocomplete/autoSearchName' //货主组件
    import autoSearchDic from '@/components/autocomplete/autoSearchDic'
    import processFormDea from './processFormDea'
    import {
        getCargoNameList
    } from '@/api/things/accountPageList'
    import {
        getRaws
    } from '@/api/raw/raw'
    export default {
        components: {
            autoSearchName,
            autoSearchDic,
            processFormDea
        },
        data() {
            return {
                cargoNameList: [], //货名
                condition: {}, // 查询条件
                person: [],
                component: '',
                dialogFormVisible: false, // table数组
                pageSearch: getRaws, // 分页查询api接口
                ldTitle: '',
                subform: {
                    entrustNo: '',
                    customDeliveryNo: '',
                    ifChange: false
                }
            }
        },
        mounted() {
            this.loadData()
            getCargoNameList(this.$store.state.user.currentUser.org.id).then(res => {
                this.cargoNameList = res.data.aaData
            })
        },
        methods: {
            loadData() {
                this.$refs.person.loadData()
            },
            handleDialogFormOpen(item) {}
        },
    }

</script>
<style lang="scss" scoped>
    .title-header {
        width: 90%;
        display: flex;
        height: 30px;
        margin-bottom: 20px;
    }

    h3 {
        margin-left: 10px;
    }

    .line {
        border-left: solid 5px #00a1ff;
        height: 18px;
        margin-top: 5px;
    }

    .gg-input {
        margin-bottom: 0 !important;
    }

    .gg-input .el-form-item__content .el-input {
        width: 100px !important;
    }

    .gg-input .el-form-item__content .el-autocomplete {
        width: 100px !important;
    }

</style>
